package third;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class StudentTest {
    public static void main(String[] args) {
        Map map = new HashMap();
        map.put(new Student(2,"关羽"),"地址2");
        map.put(new Student(3,"刘备"),"地址3");
        map.put(new Student(4,"曹操"),"地址4");
        map.put(new Student(1,"张飞"),"地址1");

        for (Object key : map.keySet()){
            Student stu = (Student)key;
            System.out.println(stu+" = "+map.get(key));
        }
        for (Object obj :map.values()){
            String loc = (String)obj;
            System.out.println(loc);
        }
        Set<Map.Entry<Student,String>> co = map.entrySet();
        for (Map.Entry<Student,String> me:co){
            System.out.println(me);
        }
    }
}
